package com.worldcup.service.impl;

import com.worldcup.dao.PredictGroupMapper;
import com.worldcup.model.PredictGroup;
import com.worldcup.service.PredictGroupService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author duwan.zq
 * @date 2018/05/26
 */
@Service
public class PredictGroupServiceImpl implements PredictGroupService {

    private final static Logger logger = LoggerFactory.getLogger(PredictGroupServiceImpl.class);

    @Autowired
    private PredictGroupMapper predictGroupMapper;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void insert(PredictGroup predictGroup) {
        predictGroupMapper.insert(predictGroup);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void batchInsert(List<PredictGroup> groups) {
        predictGroupMapper.batchInsert(groups);
    }

    @Override
    public List<PredictGroup> getPredictGroup(String openid) {
        return predictGroupMapper.selectByOpenid(openid);
    }

    @Override
    public void delete(String openid) {
        predictGroupMapper.deleteByOpenid(openid);
    }
}
